<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="InvitationEditDlg" widgetVar="InvitationEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{message.EditInvitationTitle}">
            <h:form id="InvitationEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{invitationController.selected != null}">
                        <p:outputLabel value="#{message.EditInvitationLabel_invID}" for="invID" />
                        <p:inputText id="invID" value="#{invitationController.selected.invID}" title="#{message.EditInvitationTitle_invID}" required="true" requiredMessage="#{message.EditInvitationRequiredMessage_invID}"/>
                        <p:outputLabel value="#{message.EditInvitationLabel_eventID}" for="eventID" />
                        <p:selectOneMenu id="eventID" value="#{invitationController.selected.eventID}" >
                            <f:selectItem itemLabel="#{message.SelectOneMessage}"/>
                            <f:selectItems value="#{eventController.itemsAvailableSelectOne}"
                                           var="eventIDItem"
                                           itemValue="#{eventIDItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{message.EditInvitationLabel_fromUser}" for="fromUser" />
                        <p:selectOneMenu id="fromUser" value="#{invitationController.selected.fromUser}" >
                            <f:selectItem itemLabel="#{message.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.itemsAvailableSelectOne}"
                                           var="fromUserItem"
                                           itemValue="#{fromUserItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{message.EditInvitationLabel_toUser}" for="toUser" />
                        <p:selectOneMenu id="toUser" value="#{invitationController.selected.toUser}" >
                            <f:selectItem itemLabel="#{message.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.itemsAvailableSelectOne}"
                                           var="toUserItem"
                                           itemValue="#{toUserItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{invitationController.update}" value="#{message.Save}" update="display,:InvitationListForm:datalist,:growl" oncomplete="handleSubmit(args, 'InvitationEditDialog');"/>
                    <p:commandButton value="#{message.Cancel}" onclick="InvitationEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
